﻿@using Localization.Resources.AbpUi
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@inject IHtmlLocalizer<AbpUiResource> L
@model ContentLayout

@if (Model.ShouldShowBreadCrumb())
{
    <!-- Breadcrumb for pc -->
    <nav aria-label="breadcrumb" role="navigation" class="py-2 flex-grow-1 d-none d-sm-none d-md-none d-lg-block">
        <ol class="breadcrumb mb-0" vocab="https://schema.org/" typeof="BreadcrumbList">
            @if (Model.BreadCrumb.ShowHome)
            {
                <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
                    <a class="text-decoration-none text-secondary" href="~/" add-culture="true" property="item" typeof="WebPage">
                        <span property="name">
                            @L["Home"]
                        </span>
                    </a>
                    <meta property="position" content="1">
                </li>
            }
            @foreach (var item in Model.BreadCrumb.Items)
            {
                <li class="breadcrumb-item" property="itemListElement" typeof="ListItem">
                    <a class="text-decoration-none text-secondary" href="@item.Url" add-culture="true" property="item" typeof="WebPage"><span property="name">@item.Text</span></a>
                    <meta property="position" content="@(Model.BreadCrumb.Items.IndexOf(item)+2)">
                </li>
            }
            @if (Model.BreadCrumb.ShowCurrent && !Model.Title.IsNullOrEmpty())
            {
                <li class="breadcrumb-item active" aria-current="page" property="itemListElement" typeof="ListItem">
                    <span property="name">@Model.Title</span>
                    <meta property="position" content="@(Model.BreadCrumb.Items.Count+2)">
                </li>
            }
        </ol>
    </nav>

    <!-- Navigation for mobile -->
    @if (Model.BreadCrumb.Items.Any())
    {
        var item = Model.BreadCrumb.Items.Last();
        <nav role="navigation" class="py-2 flex-grow-1 d-block d-sm-block d-md-block d-lg-none">
            <a href="@item.Url" add-culture="true" class="text-decoration-none text-secondary"><i class="fas fa-chevron-left"></i> @item.Text</a>
        </nav>
    }
    else if (Model.BreadCrumb.ShowHome)
    {
        <nav role="navigation" class="py-2 flex-grow-1 d-block d-sm-block d-md-block d-lg-none">
            <a href="~/" add-culture="true" class="text-decoration-none text-secondary"><i class="fas fa-chevron-left"></i> @L["Home"]</a>
        </nav>
    }
    @*
    @if (Model.BreadCrumb.ShowCurrent && !Model.Title.IsNullOrEmpty())
    {
        <span class="d-block d-sm-block d-md-block d-lg-none position-absolute w-50 top-0 start-50 translate-middle-x text-center py-2">
            @Model.Title
        </span>
    }
    *@
}
